<div class="content-section introduction " >
  <div>
    <span class="feature-title">系统管理 | <small>人员管理</small> </span>
  </div>
</div>
<div class="content-section myimplementation GridDemo report">
  <div class="ui-g">
    <div class="ui-g-3">
      <h4 style="margin-bottom: 15px;">组织</h4>
      <p-tree [value]="orgs" selectionMode="single" [(selection)]="selected" (onNodeExpand)="nodeExpand($event)"(onNodeSelect) = "NodeSelect($event)" [contextMenu]="cm"></p-tree>
      <p-contextMenu #cm [model]="items"></p-contextMenu>
    </div>
    <div class="ui-g-9">
      <h4>{{ titleName }}</h4>
      <div class="ui-grid-row text_aligin_right">
        <button pButton type="button" class="btn_add" (click)="showPerEdit()" label="新增" icon="fa-plus" [disabled]="canAdd"></button>
        <button pButton type="button" class="btn_add" (click)="showPerDelete()" label="删除" icon="fa-close"></button>

        <div class="ui-widget-header" style="padding:4px 10px;border-bottom: 0 none">
          <i class="fa fa-search" style="margin:4px 4px 0 0"></i>
          <input #gb type="text" pInputText size="50" placeholder="查询">
        </div>

        <p-dataTable [value]="tableDatas"
                     [responsive]="true"  id="manageTable" [lazy]="true" [rows]="10" [paginator]="true" [rowsPerPageOptions]="[10,15,20]" totalRecords="{{totalRecords}}" (onLazyLoad)="loadTableData($event)" [(selection)]="selectedPers" [globalFilter]="gb">
          <!--<p-footer>-->
          <!--<p-paginator rows="10" totalRecords="120" [rowsPerPageOptions]="[10,20,30]" pageLinkSize="10"></p-paginator>-->
          <!--</p-footer>-->
          <p-column selectionMode="multiple" ></p-column>
          <p-column field="pid" header="帐号" [sortable]="true"></p-column>
          <p-column field="name" header="姓名" [sortable]="true"></p-column>
          <p-column field="mobile" header="手机" [sortable]="true"></p-column>
          <p-column field="organization" header="组织" [sortable]="true"></p-column>
          <p-column field="post" header="职位" [sortable]="true"></p-column>
          <p-column field="color" header="操作" [style]="{'width':'12vw'}">
            <ng-template let-datas="rowData" pTemplate="operator">
              <button pButton type="button"  (click)="showPerEdit(datas)" label="编辑"  class="ui-button-info"></button>
              <button pButton type="button"  (click)="showPerDelete(datas)" label="删除"  class="ui-button-info"></button>
              <button pButton type="button" *ngIf="datas.pid != 'admin'" (click)="showCogRoleMask(datas,true)" label="关联角色"  class="ui-button-info"></button>
              <button pButton type="button"  (click)="showCogRoleMask(datas,false)" label="查看角色"   class="ui-button-info"></button>
              <button pButton type="button"  (click)="modifyPassword(datas)" label="修改密码"   class="ui-button-info"></button>
            </ng-template>
          </p-column>
          <ng-template pTemplate="emptymessage">
            当前没有数据
          </ng-template>
        </p-dataTable>
      </div>
    </div>
  </div>
  <!--<div class="ui-grid-row">
    <div class="ui-grid-col-3">
      <h4>组织</h4>
      <p-tree [value]="orgs" selectionMode="single" [(selection)]="selected" (onNodeExpand)="nodeExpand($event)"(onNodeSelect) = "NodeSelect($event)"
      ></p-tree>
    </div>
    <div class="ui-grid-col-1" style="height: 1px;"></div>
    <div class="ui-grid-col-8">
      <h4>{{ titleName }}</h4>
      <div class="ui-grid-row text_aligin_right">
        <button pButton type="button" class="btn_add" (click)="add()" label="新增" icon="fa-plus" [disabled]="canAdd"></button>
        <p-dataTable [value]="tableDatas"
                     [responsive]="true"  id="manageTable">
          &lt;!&ndash;<p-footer>&ndash;&gt;
          &lt;!&ndash;<p-paginator rows="10" totalRecords="120" [rowsPerPageOptions]="[10,20,30]" pageLinkSize="10"></p-paginator>&ndash;&gt;
          &lt;!&ndash;</p-footer>&ndash;&gt;
          <p-column selectionMode="multiple" ></p-column>
          <p-column field="pid" header="帐号" [sortable]="true"></p-column>
          <p-column field="name" header="姓名" [sortable]="true"></p-column>
          <p-column field="mobile" header="手机" [sortable]="true"></p-column>
          <p-column field="organization" header="组织" [sortable]="true"></p-column>
          <p-column field="pid" header="职位" [sortable]="true"></p-column>
          <p-column field="color" header="操作项" [style]="{'width':'12vw'}">
            <ng-template let-datas="rowData" pTemplate="operator">
              <button pButton type="button"  (click)="edit(datas)" label="编辑"  class="ui-button-info"></button>
              <button pButton type="button"  (click)="frezzeOrActive(datas)" label="启用"  class="ui-button-info" *ngIf="datas.status == '冻结'"></button>
              <button pButton type="button"  (click)="frezzeOrActive(datas)" label="冻结"  class="ui-button-info" *ngIf="datas.status == '启用'"></button>
              <button pButton type="button"  (click)="delete(datas)" label="删除"   class="ui-button-info"></button>
              &lt;!&ndash;<button pButton type="button"  (click)="view(datas)" label="查看"   class="ui-button-info"></button>&ndash;&gt;
            </ng-template>
          </p-column>
          <ng-template pTemplate="emptymessage">
            当前没有数据
          </ng-template>
        </p-dataTable>
      </div>
    </div>
  </div>-->

  <!--<p-dialog header="新增" [(visible)]="addDisplay" modal="modal" width="300" [responsive]="true">
    <div class="ui-grid-row">
      <p-messages [(value)]="msgs"></p-messages>
      <div class="ui-grid-col-12">
        <div class="ui-grid-col-2">
          <label for="">名称</label>
        </div>
        <div class="ui-grid-col-10">
          <input  type="text" pInputText  [style.width.%]="90" placeholder="请输入名称" [(ngModel)]="dataName" required="required"/>
        </div>
      </div>
      <div class="ui-grid-col-12">
        <div class="ui-grid-col-2">
          <label for="">状态</label>
        </div>
        <div class="ui-grid-col-10">

          <p-radioButton name="group" value="启用" label="启用" [(ngModel)]="val1" inputId="preopt3"></p-radioButton>
          <p-radioButton name="group" value="冻结" label="冻结" [(ngModel)]="val1" inputId="preopt4"></p-radioButton>

        </div>
      </div>
    </div>
    <p-footer>
      <button type="button" pButton icon="fa-check" (click)="ansureAddDialog()" label="新增" *ngIf="addOrEdit == 'add'"></button>
      <button type="button" pButton icon="fa-check" (click)="ansureEditDialog()" label="编辑" *ngIf="addOrEdit == 'edit'"></button>
      <button type="button" pButton icon="fa-close" (click)="addDisplay=false" label="取消"></button>
    </p-footer>
  </p-dialog>
  <p-growl [(value)]="msgPop"></p-growl>-->
</div>


<p-growl [(value)]="msgs"></p-growl>

<!-- 删除组织弹框 -->
<p-growl [(value)]="deletemsgs"></p-growl>
<p-dialog header="删除确认框" [(visible)]="showOrgDeleteMask" modal="modal" width="300" [responsive]="true">
  <p>{{deleteOrgTip}}</p>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="deleteOrg()" label="确定"></button>
    <button type="button" pButton icon="fa-close" (click)="showOrgDeleteMask=false" label="取消"></button>
  </p-footer>
</p-dialog>

<!-- 删除人员弹框 -->
<p-growl [(value)]="deletemsgs"></p-growl>
<p-dialog header="删除确认框" [(visible)]="showPerDeleteMask" modal="modal" width="300" [responsive]="true">
  <p>{{deletePerTip}}</p>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="deletePer()" label="确定"></button>
    <button type="button" pButton icon="fa-close" (click)="showPerDeleteMask=false" label="取消"></button>
  </p-footer>
</p-dialog>

<!-- 新增和修改组织弹框 -->
<app-org-edit [currentOrg]="selectedNode" [state]="state" (closeOrgEdit)="closeOrgEdit($event)" (addOrg)="addOrgNode($event)" (updateOrg)="updateOrgNode($event)" *ngIf="showOrgEditMask"></app-org-edit>

<!-- 新增和编辑人员弹框 -->
<app-person-edit [currentPer]="selectedCol" [state]="personState" (closePersonEdit)="closePersonEdit($event)" (addPer)="addPersonNode($event)" (updatePer)="updatePersonNode($event)" *ngIf="showPersonEditMask"></app-person-edit>

<!-- 关联角色和查看角色弹框 -->
<app-cognate-role [currentPid]="selectedPid" [state]="roleState" (closeCognateRole)="closeCognateRole($event)"  (cognateRole)="cognateRoleBack($event)"*ngIf="showCognateRoleMask"></app-cognate-role>

<!-- 修改密码弹框 -->
<app-password-modify [currentNum]="selectedNum" (closePasswordMod)="closePasswordMod($event)"  (passwordModify)="passwordModifyBack($event)"*ngIf="showPasswordModMask"></app-password-modify>
